import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
	state: {
		userInfo: {},
		isLogin: false,
		phoneInfo: {},
		socket: {}
	},
	mutations: {
		setUserInfo(state, val) {
			state.userInfo = val
			// state.isLogin = true
			//设置本地存储
			uni.setStorage({
				key: 'userInfo',
				data: val
			})

		},
		setPhoneInfo(state, val) {
			state.phoneInfo = val
		},
		setSocket(state, val) {
			state.socket = val
		},
		initSocket() {
			Vue.prototype.$socket = socket.connect(('http://192.168.0.106:3000'))
		}
	},
	actions: {}
})
